<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload=function(){
            var btns=document.getElementsByTagName('button');
            btns[0].onclick=function(){
                sessionStorage.setItem('name','lisi');
                sessionStorage.setItem('age',20);
            }
            btns[1].onclick=function(){
                console.log(sessionStorage.getItem('name'));
            }
        }
    </script>
</head>
<body>
    <button>set</button>
    <button>get</button>
</body>
</html>